package com.bicon.botu.medical.common.enums

import com.baomidou.mybatisplus.enums.IEnum
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonValue
import java.io.Serializable

enum class StatusEnum(private val status: String) : IEnum {
    DEL_LOGIC_NORMAL("0"),
    DEL_LOGIC_INVALID("0");

    /**
     * 短信验证码
     */
    val REDISPREFIX_CODE = "account:auth:code:"

    /**
     * 验证码过期时间
     */
    val CODE_EXPIRE_TIME: Long = 600


    @JsonValue
    override fun getValue(): Serializable {
        return this.status
    }

    companion object {
        @JsonCreator
        @JvmStatic
        fun creator(value: String): StatusEnum {
            val found = StatusEnum.values().find { it.value == value }

            if (found != null) {
                return found
            } else {
                throw IllegalArgumentException("not found StatusEnum with $value")
            }
        }
    }

}